$.fn.extend({
    lazyload() {
        //console.log(this)
        let totalHeight =
            (window.innerHeight || document.documentElement.clientHeight) +
            (document.body.scrollTop || document.documentElement.scrollTop)
        //console.log(totalHeight)
        $('img').each((index, item) => {
            //console.log(item)
            let currentHeight = $(item).offset().top
            //console.log(currentHeight)
            if (totalHeight >= currentHeight) {
                $(item).attr('src', $(item).attr('data-original'))
            }
        })
        window.onscroll = $.fn.lazyload
    },
})
